package com.lykj.llw.box.ui.activity

import android.os.Bundle
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.gyf.immersionbar.BarHide
import com.gyf.immersionbar.ImmersionBar
import com.lykj.lib_base.base.BaseActivity
import com.lykj.lib_base.component.GlideApp
import com.lykj.lib_base.internal.extfun.clickWithTrigger
import com.lykj.llw.box.databinding.ActImageDisplayBinding

/**
 * ================================================
 * 图片展览界面
 * ================================================
 *
 * @author gosha
 * @date 2023/1/17-15:28
 */
class ImageDisplayActivity : BaseActivity() {
    lateinit var binding: ActImageDisplayBinding
    var pic = ""

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActImageDisplayBinding.inflate(layoutInflater)

        setContentView(binding.root)

        initUI()
        initData()
        setListener()
    }

    override fun initUI() {
        ImmersionBar.with(this).transparentBar()
            .statusBarDarkFont(false) //状态栏字体是深色，不写默认为亮色
            .navigationBarDarkIcon(false)
            .hideBar(BarHide.FLAG_HIDE_NAVIGATION_BAR)
            .navigationBarEnable(false)
            .init()
    }

    override fun initData() {
        pic = intent.getStringExtra("pic").toString()

        GlideApp.with(this)
            .load(pic)
            .transition(DrawableTransitionOptions.withCrossFade())
            .into(binding.ivDisplay)
    }

    override fun setListener() {
        binding.ivClose.clickWithTrigger {
            finish()
        }
    }
}